package enviro;

import entity.Entity;
import java.awt.Point;
import java.io.Serializable;

public class Dungeon implements Environment, Serializable{
	
    // <editor-fold defaultstate="collapsed" desc="Member Variables">
    
	Tile[][] tiles; // The tiles array constitutes the tiles of the map
	private int width; // This is the height of the map
	private int height; // This is the width of the map
    
    // </editor-fold>
        
    // <editor-fold defaultstate="collapsed" desc="Constructor(s)">
	
	/**
	 * Constructor 
	 * 
	 * This constructor builds a map according to the specified size, but
	 * does not define the map itself.
	 * 
	 * @param width
	 *   This is the intended width of the map
	 * @param height
	 *   This is the intended height of the map.
	 */
	public Dungeon(int width, int height) {
		
		// Set width and height of map
		this.width = width;
		this.height = height;
		
		// Create a new tile array to represent the map
		tiles = new Tile[width][height];
	}
        
    // </editor-fold>
	
    // <editor-fold defaultstate="collapsed" desc="API">    
     
	/** 
	 * Get Tile
	 * 
	 * Return a specific tile at a given coordinate, referened
	 * by an x,y value pair
	 * 
	 * @param locX
	 *   This is the x-value of the grid coord
	 * @param locY
	 *   This is the y-value of the grid coord
	 *   
	 * @return
	 *   This method returns the tile to the caller
	 */
	public Tile getTile(int locX, int locY){
		return tiles[locX][locY];
	}
	
	/**
	 * Get Tile 
	 * (OVERLOAD 1)
	 * 
	 * This method does the exact same thing as its master method,
	 * but takes a point instead of an x,y pair.  This is set for 
	 * the convenience of the programmer.
	 * 
	 * @param location 
	 *   This is the x,y valued point from which to pull the tile
	 */
	public Tile getTile(Point location) {
		return tiles[location.x][location.y];
	}
        
        // This method is not used for anything at this time.
        @Override
        public boolean placeEntity(int[][] position, Entity entity) {
            
            // This method is not used for anything at this time.
            return false;
        }
	
	/**
	 * STANDARD GET / SET METHODS
	 */
	public Tile[][] getTiles() {
		return tiles;
	}
	public void setTiles(Tile[][] tiles) {
		this.tiles = tiles;
	}
	
	public int getHeight() {
		return height;
	}
	public void setHeight(int height) {
		this.height = height;
	}
	
	public int getWidth() {
		return width;
	}
	public void setWidth(int width) {
		this.width = width;
	}
        
    // </editor-fold>

}
